package com.igeek.shop.service;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.igeek.shop.dao.BaseDao;
import com.igeek.shop.entity.Area;



public class LinkageService {
	public static void getJson(Object[] params,HttpServletResponse response){
		String sql = "select * from area where area_parent_id = ?";
		BaseDao<Area> dao = new BaseDao<Area>();
		Object list = dao.getList(sql, params, new Area());
		List<Area> areaList = (List<Area>) list;
		ObjectMapper mapper = new ObjectMapper();
		String json=null;
		try {
			json = mapper.writeValueAsString(areaList);
			response.setContentType("text/html;charset=utf-8");
			response.getWriter().write(json);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	
}
